package io.renren.modules.work.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.work.entity.ScExtrasEntity;
import io.renren.modules.work.service.ScExtrasService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2022-09-01 10:12:15
 */
@RestController
@RequestMapping("work/scextras")
public class ScExtrasController {
    @Autowired
    private ScExtrasService scExtrasService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = scExtrasService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{extrasId}")
    public R info(@PathVariable("extrasId") String extrasId){
		ScExtrasEntity scExtras = scExtrasService.getById(extrasId);

        return R.ok().put("scExtras", scExtras);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody ScExtrasEntity scExtras){
		scExtrasService.save(scExtras);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody ScExtrasEntity scExtras){
		scExtrasService.updateById(scExtras);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] extrasIds){
		scExtrasService.removeByIds(Arrays.asList(extrasIds));

        return R.ok();
    }
    /**
     * 新增（app)
     */
    @RequestMapping("mSave")
    public R mSave(@RequestBody String params){
        return scExtrasService.mSave(params);
    }

    /**
     * 修改（app）
     */
    @RequestMapping("mUpdate")
    public R mUpdate(@RequestBody String params){
        return scExtrasService.mUpdate(params);
    }

    /**
     * 信息（app）
     */
    @RequestMapping("mInfo")
    public R mInfo(@RequestParam String extrasId){
        return scExtrasService.mInfo(extrasId);
    }

}
